package org.csmzxy.class2334;

import java.io.File;
import java.io.FilenameFilter;

public class Example1805 {
    public static void main(String[] args) {
        File file = new File("D:\\2334-java-demo\\湛昵楠-42");
        FilenameFilter filter = new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                File currFile = new File(dir,name);
                if (currFile.isFile() && name.endsWith(".txt")){
                    return true;
                }else {

                    return false;
                }
            }
        };
        if (file.exists()){
            String[] lists = file.list(filter);
            for (String list : lists){
                System.out.println(list);
            }
        }
    }
}